
#include <QPushButton>
#include <QVBoxLayout>
#include <QFont>

#include "ChooseMainWindow.h"
#include "ChessBoard.h"

#define XPROJECT_VERSION "1.0"

ChooseMainWindow::ChooseMainWindow(QWidget *parent) : QDialog(parent)
{
    this->setWindowTitle(QString("选择游戏方式 %1").arg(XPROJECT_VERSION));
    this->setFixedSize(360, 160);

    m_buttons[0] = new QPushButton(QStringLiteral("开始游戏"), this);
    m_buttons[0]->setFont(QFont("STKaiti", 16)); // 字体
    m_buttons[0]->setFlat(true); // 去边框

    QVBoxLayout* lay = new QVBoxLayout(this);
    lay->addWidget(m_buttons[0]);

    // 信号和槽
    connect(m_buttons[0], &QPushButton::clicked,[=](){
        this->hide(); // 隐藏
        
        m_pAgainstYourself = new ChessBoard();
        m_pAgainstYourself->setWindowTitle(QString("中国象棋 %1").arg(XPROJECT_VERSION));
        m_pAgainstYourself->show();

        // //返回主窗口
        // connect(m_pAgainstYourself,&ChessBoard::toMenu,[=](){
        //     m_pAgainstYourself->close();
        //     this->show();
        // });
    });

}